/*
    REDLisp - interpreter/compiler for new dialect of LISP called REDLISP
    Copyright (C) 2006  Rudolf Olah

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef FUNCTIONS_H
#define FUNCTIONS_H

#include <crisscross/universal_include.h>
#include "types.h"
#include "core.h"
#include "logic.h"
#include "eval_parser.h"

// Module loading system
#ifdef TARGET_OS_WINDOWS
#include <windows.h>
#else
#include <dlfcn.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <sstream>
#include <ctime>

using namespace std;
using namespace CrissCross::IO;

#ifdef ENABLE_DEBUGLOG
using namespace CrissCross::Debug;

extern CoreDebugLog *debuglog;
#endif

extern CoreConsole *console;

void loadCoreFunctions ();

dObject *dCons (dList *args);
dObject *dQuote (dList *args);

dObject *dTokenize (dList *args);
dObject *dLookup (dList *args);
dObject *dSystemCall (dList *args);
dObject *dVersion (dList *args);
dObject *dQuit (dList *args);
dObject *dIsAtom (dList *args);
dObject *dFirst (dList *args);
dObject *dRest (dList *args);
dObject *dLast (dList *args);
dObject *dSlice (dList *args);
dObject *dLength (dList *args);

// Major user functions
dObject *dDateTime (dList *args);
dObject *dInput (dList *args);
dObject *dPrint (dList *args);
dObject *dFormat (dList *args);
dObject *dPrintFormat (dList *args, bool p=true);
dObject *dMakeList (dList *args);

// Math functions
dObject *dAdd (dList *args);
dObject *dSubtract (dList *args);
dObject *dMultiply (dList *args);
dObject *dDivide (dList *args);
dObject *dDiv (dList *args);
dObject *dMod (dList *args);

extern dSymbol *T;
extern dList *nil;
extern dList *system_environment;
extern dList *loaded_modules;

#endif
